package tx.bj12320.model;

import javax.persistence.*;

import org.hibernate.annotations.GenericGenerator;

import javax.validation.constraints.*;
import org.hibernate.validator.constraints.*;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;

import java.util.*;

import javacommon.base.*;
import javacommon.util.*;

import cn.org.rapid_framework.util.*;
import cn.org.rapid_framework.web.util.*;
import cn.org.rapid_framework.page.*;
import cn.org.rapid_framework.page.impl.*;

import tx.bj12320.model.*;
import tx.bj12320.dao.*;
import tx.bj12320.service.*;
import tx.bj12320.vo.query.*;


@Entity
@Table(name = "BJ12320_INFOISSUE_VIEW_LOG")
public class InfoissueViewLog extends BaseEntity implements java.io.Serializable{
	private static final long serialVersionUID = 5454155825314635342L;

	//alias
	public static final String TABLE_ALIAS = "InfoissueViewLog";
	public static final String ALIAS_INFOISSUE_VIEW_LOG_ID = "infoissueViewLogId";
	public static final String ALIAS_INFOISSUE_ID = "infoissueId";
	public static final String ALIAS_USER_INFO_ID = "userInfoId";
	public static final String ALIAS_VIEW_LOG_DATE = "viewLogDate";

	//date formats
	public static final String FORMAT_VIEW_LOG_DATE = DATE_TIME_FORMAT;


	//可以直接使用: @Length(max=50,message="用户名长度不能大于50")显示错误消息
	//columns START
    /**
     * infoissueViewLogId       db_column: INFOISSUE_VIEW_LOG_ID
     */

	private Long infoissueViewLogId;
    /**
     * infoissueId       db_column: INFOISSUE_ID
     */

	private Long infoissueId;
    /**
     * userInfoId       db_column: USER_INFO_ID
     */

	private Long userInfoId;
    /**
     * viewLogDate       db_column: VIEW_LOG_DATE
     */

	private java.util.Date viewLogDate;
	//columns END


	public InfoissueViewLog(){
	}

	public InfoissueViewLog(
		Long infoissueViewLogId
	){
		this.infoissueViewLogId = infoissueViewLogId;
	}



	public void setInfoissueViewLogId(Long value) {
		this.infoissueViewLogId = value;
	}

	@Id	@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="BJ12320_INFOISSUE_VIEWLOG_SEQU")
    @SequenceGenerator(name="BJ12320_INFOISSUE_VIEWLOG_SEQU",allocationSize=1,initialValue=1, sequenceName="BJ12320_INFOISSUE_VIEWLOG_SEQU")
	@Column(name = "INFOISSUE_VIEW_LOG_ID", unique = true, nullable = false, insertable = true, updatable = true, length = 0)
	public Long getInfoissueViewLogId() {
		return this.infoissueViewLogId;
	}

	@Column(name = "INFOISSUE_ID", unique = false, nullable = true, insertable = true, updatable = true, length = 0)
	public Long getInfoissueId() {
		return this.infoissueId;
	}

	public void setInfoissueId(Long value) {
		this.infoissueId = value;
	}

	@Column(name = "USER_INFO_ID", unique = false, nullable = true, insertable = true, updatable = true, length = 0)
	public Long getUserInfoId() {
		return this.userInfoId;
	}

	public void setUserInfoId(Long value) {
		this.userInfoId = value;
	}

	@Transient
	public String getViewLogDateString() {
		return DateConvertUtils.format(getViewLogDate(), FORMAT_VIEW_LOG_DATE);
	}
	public void setViewLogDateString(String value) {
		setViewLogDate(DateConvertUtils.parse(value, FORMAT_VIEW_LOG_DATE,java.util.Date.class));
	}

	@Column(name = "VIEW_LOG_DATE", unique = false, nullable = true, insertable = true, updatable = true, length = 7)
	public java.util.Date getViewLogDate() {
		return this.viewLogDate;
	}

	public void setViewLogDate(java.util.Date value) {
		this.viewLogDate = value;
	}


	private Infoissue infoissue;
	public void setInfoissue(Infoissue infoissue){
		this.infoissue = infoissue;
	}

	@ManyToOne(cascade = {}, fetch = FetchType.LAZY)
	@JoinColumns({
		@JoinColumn(name = "INFOISSUE_ID",nullable = false, insertable = false, updatable = false)
	})
	public Infoissue getInfoissue() {
		return infoissue;
	}

	private UserInfo userInfo;
	public void setUserInfo(UserInfo userInfo){
		this.userInfo = userInfo;
	}

	@ManyToOne(cascade = {}, fetch = FetchType.LAZY)
	@JoinColumns({
		@JoinColumn(name = "USER_INFO_ID",nullable = false, insertable = false, updatable = false)
	})
	public UserInfo getUserInfo() {
		return userInfo;
	}

	public String toString() {
		return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
			.append("InfoissueViewLogId",getInfoissueViewLogId())
			.append("InfoissueId",getInfoissueId())
			.append("UserInfoId",getUserInfoId())
			.append("ViewLogDate",getViewLogDate())
			.toString();
	}

	public int hashCode() {
		return new HashCodeBuilder()
			.append(getInfoissueViewLogId())
			.toHashCode();
	}

	public boolean equals(Object obj) {
		if(obj instanceof InfoissueViewLog == false) return false;
		if(this == obj) return true;
		InfoissueViewLog other = (InfoissueViewLog)obj;
		return new EqualsBuilder()
			.append(getInfoissueViewLogId(),other.getInfoissueViewLogId())
			.isEquals();
	}
}

